Skip to content

Conversation

@jchyb
Copy link
Contributor

@jchyb jchyb commented Oct 9, 2025

Fixes #23969

The regression would not appear on main (only after release on the nightly version of the compiler, as explained here), so I've adjusted the test to be more general.

@jchyb jchyb requested a review from a team as a code owner October 9, 2025 13:03
@jchyb jchyb changed the title Fix regression #23969 Add ensureApplied to the quotes reflect API Fix regression #23969: Add ensureApplied to the quotes reflect API Oct 9, 2025
@jchyb jchyb force-pushed the fix-i23969 branch 2 times, most recently from 5a6580c to 2f0d636 Compare October 26, 2025 21:00
Comment on lines +5 to +6
def a1 = ()
def a2() = ()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious about what will happen if we do this?

Suggested change
def a1 = ()
def a2() = ()
def a1[T] = ()
def a2[T]() = ()

At least, we should include them in the test.

@jchyb jchyb requested a review from hamzaremmal October 28, 2025 11:06
Select.unique('{TestMethods}.asTerm, "a3").ensureApplied match
case Select(_, _) =>
case other => assert(false)
Select.unique('{TestMethods}.asTerm, "a4").ensureApplied match
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmmh, this is a legitimate question, but if we have a transparent inline method, it is subject to type inference, why shouldn't we wrap then in an Apply and let type inference do it's thing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will result in:

-- Error: tests/pos-macros/i23969/Main.scala:1:19 ------------------------------
1 |@main def Test() = runMacro()
  |                   ^^^^^^^^^^
  |                  method a4 in object TestMethods does not take parameters

error, thrown from tpd.Apply. Even if we were to change that, we would have to deal with the TreeChecker run right after the macro expansion. In general, I believe we have to return fully typed trees and I am not aware of any additional type inference done to inlined code after inlining it (so it will be done for quoted code before the macro is expanded, or for non-macro inline method contents, but not changed after inlining, even for non-macro transparent inline methods, more info here: #8739).

Also apologies for weird response times! And thank you for looking at this @hamzaremmal

@jchyb jchyb added this to the 3.8.0 milestone Oct 29, 2025
@jchyb jchyb added the needs-minor-release This PR cannot be merged until the next minor release label Oct 29, 2025
@jchyb jchyb requested a review from hamzaremmal October 29, 2025 11:36
@hamzaremmal hamzaremmal added the backport:nominated If we agree to backport this PR, replace this tag with "backport:accepted", otherwise delete it. label Oct 29, 2025
@hamzaremmal hamzaremmal merged commit c2d8e84 into scala:main Oct 29, 2025
51 checks passed
@hamzaremmal hamzaremmal deleted the fix-i23969 branch October 29, 2025 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:nominated If we agree to backport this PR, replace this tag with "backport:accepted", otherwise delete it. needs-minor-release This PR cannot be merged until the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect does not take parameters error when using quotes reflection

2 participants